home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
TurboTCP 1.0.1
/
TurboTCP.source
/
cast.h
next >
Wrap
Text File
|
1993-07-09
|
573b
|
22 lines
/*
Cast.h
Provides a debug macro which casts an object, and asserts that the
object is a member of the class cast to.
*/
// thanks to a unknown contributor to "comp.sys.mac.oop.tcl" for this file -ES
#ifdef __TCL_DEBUG__
static CObject * gCastObject;
#define CAST( object, class ) (gCastObject = (CObject*)(object), ASSERT(member(gCastObject, class)), (class *) (gCastObject))
#else
#define CAST( object, class ) ((class *) (object))
#endif
#define CheckedCast(obj,type) \
(((obj) && member((obj),type)) ? ((type *) (obj)) : nil)